home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / DelegatePool.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.1 KB  |  69 lines

  1. /* Interface for Objective-C "collection of delegates" object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. /* Using this object, a delegator can have an arbitrary number of
  25.    delegates.  Send a message to this object and the message will get
  26.    forwarded to the delegates on the list. */
  27.  
  28. #ifndef __DelegatePool_h_OBJECTS_INCLUDE
  29. #define __DelegatePool_h_OBJECTS_INCLUDE
  30.  
  31. #include <objects/stdobjects.h>
  32. #include <objects/Array.h>
  33.  
  34. /* Available sending behaviors */
  35. enum DelegatePoolSendBehavior {SEND_TO_ALL = 0, 
  36.                    SEND_TO_FIRST_RESPONDER,
  37.                    SEND_UNTIL_YES,
  38.                    SEND_UNTIL_NO};
  39.  
  40. @interface DelegatePool
  41. {
  42.   struct objc_class *isa;
  43.   @public
  44.   unsigned char _send_behavior;
  45.   Array *_list;
  46. }
  47.  
  48. // CREATING AND FREEING;
  49. + alloc;
  50. + new;
  51. - init;
  52. - free;
  53.  
  54. // MANIPULATING COLLECTION OF DELEGATES;
  55. - delegatePoolAddObject: anObject;
  56. - delegatePoolAddObjectIfAbsent: anObject;
  57. - delegatePoolRemoveObject: anObject;
  58. - (BOOL) delegatePoolIncludesObject: anObject;
  59. - delegatePoolCollection;
  60. - (unsigned char) delegatePoolSendBehavior;
  61. - delegatePoolSetSendBehavior: (unsigned char)b;
  62.  
  63. // FOR PASSING ALL OTHER MESSAGES TO DELEGATES;
  64. - forward:(SEL)aSel :(arglist_t)argFrame;
  65.  
  66. @end
  67.  
  68. #endif /* __DelegatePool_h_OBJECTS_INCLUDE */
  69.